package app.web.cartoon.report.num.tab;

import app.portal.dict.transform.dll.column.OracleColumn;
import app.web.cartoon.report.num.tool.CartoonNumReport;
import cn.lily.com.exception.YaconException;
import cn.lily.web.page.BusinessPage;
import cn.lily.web.widget.sql.TSqlGrid;
import cn.lily.web.widget.standard.TButton;
import cn.lily.web.widget.standard.TButtonPilot;
/**
 * 动漫基本总数统计
 * @author JiaJ
 *
 */
public class NumReport extends BusinessPage {

	@Override
	public void page_onLoad() throws YaconException {
		
		 TSqlGrid numGrid = sqlGrid("numGrid");
		 numGrid.setDictTable("LEO_CAN_REPORT_NUM");
		 String sqlString = " select to_char(RES_TIME,'yyyy-mm-dd hh24:mi:ss') RES_TIME,LEO_CAN_DATE_INF,LEO_CAN_NUM_TOTAL,LEO_CAN_NUM_ADD "
		 				  + " from ${schema}.LEO_CAN_REPORT_NUM "
		 				  + " order by RES_TIME DESC ";
		 numGrid.setCommSqlStr(sqlString);
		 numGrid.setEdit(true);

	     numGrid.createFieldTitle("RES_TIME").setFieldVisible(false);
		 numGrid.createFieldTitle("LEO_CAN_DATE_INF");
		 numGrid.createFieldTitle("LEO_CAN_NUM_TOTAL");
		 numGrid.createFieldTitle("LEO_CAN_NUM_ADD");

		 TButtonPilot singleTablePilot = ButtonPilot("numGridPilot");
		 singleTablePilot.setPilotIco("/widget/buttonPilot.gif");
		 singleTablePilot.setPilotText("动漫数量统计");

		 TButton numReport = new TButton("numReportBtn");
		 numReport.setIcoPath("glyphicon glyphicon-th-large");
		 numReport.setLabel("动漫数量统计");
		 numReport.setViewClick("numReportBtn_onclick");
		 singleTablePilot.addButtons(numReport);

		 numGrid.setButtonPilot(singleTablePilot);
		 
		 numGrid.setTopButtonType("all");
		 
		 getPage().addElement(numGrid);

		
	}
	
	public void refresh(){
		 TSqlGrid numGrid = sqlGrid("numGrid");
		 String sqlString = " select to_char(RES_TIME,'yyyy-mm-dd hh24:mi:ss') RES_TIME,LEO_CAN_DATE_INF,LEO_CAN_NUM_TOTAL,LEO_CAN_NUM_ADD "
		 				  + " from ${schema}.LEO_CAN_REPORT_NUM "
		 				  + " order by RES_TIME DESC ";
		 numGrid.setCommSqlStr(sqlString);
		 this.setSelfMessage(numGrid.getDataElement());
	}
	
	public void numReport(){
		
		try {
			
			CartoonNumReport numReport = new CartoonNumReport();		
			numReport.inst();
			
		} catch (Exception e) {
			e.printStackTrace();
			this.setSelfMessage("动漫数量统计失败！");
		}
		
		this.setSelfMessage("动漫数量统计成功！");
	}
	

}
